<!--河南星辰软件科技有限公司
@copyright Copyright (c) 2010~2022 All rights reserved.
-->
<template>
  <div class='app-container'>
    <el-row>
      <el-col :span='22' :xs='24'>
        <el-form ref="form" :model="predict_part" :rules="rules" label-width="100px" id="mvcfm">
          <el-button @click="businesStructureAddSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
          <el-button @click="gotoPage('FCE7214635C54924BCDDD19A731C55A2?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
          <div class="form-unit">
            <span class="mvc-title-left"> 添加组成部分 </span>
          </div>
          <div>
            <input type="hidden" id="predict_id" name="predict_id" :value="predict_part.predict_id">
            <el-row>
              <el-col :span="12">
                <el-form-item label="组成部分描述" prop="part_des">
                  <el-input v-model="predict_part.part_des" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="分配到" prop="part_person">
                  <el-select style='width:100%' v-model="predict_part.part_person">
                    <el-option label="－－无－－" value='' />
                    <el-option v-for="dict in person" :key="dict.__code" :label="dict.__desc" :value="dict.__code"></el-option>
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="组成部分" prop="">
                  <el-link @click="gotoPage('17F9280664D94845A9579AC08B784EBD?'+vueparams+'')" type='primary'></el-link>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="24">
                <el-form-item label="额外的信息" prop="part_extrades">
                  <el-input type="textarea" v-model="predict_part.part_extrades" ttparea=350></el-input>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="信息来源" prop="part_origin">
                  <el-select style='width:100%' v-model="predict_part.part_origin">
                    <el-option label="1" value="1" />
                    <el-option label="2" value="2" />
                    <el-option label="3" value="3" />
                    <el-option label="4" value="4" />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="高估    CNY" prop="part_max">
                  <el-input v-model="predict_part.part_max" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="低估    CNY" prop="part_min">
                  <el-input v-model="predict_part.part_min" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="最佳预计    CNY" prop="part_opt">
                  <el-input v-model="predict_part.part_opt" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="关闭可能性(%)" prop="part_clised">
                  <el-input v-model="predict_part.part_clised" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="估计关闭日期" prop="part_closedate">
                  <el-date-picker v-model="predict_part.part_closedate" type="date" style='width:100%' value-format="yyyy-MM-dd" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="估计期限" prop="part_limit">
                  <el-input v-model="predict_part.part_limit" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-select style='width:100%' v-model="empty">
                  <el-option label="周" value="周" />
                  <el-option label="月" value="月" />
                </el-select>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="当前状态" prop="">
                  <el-select style='width:100%' v-model="empty">
                    <el-option label="首次电话-陌生访问" value="首次电话-陌生访问" />
                  </el-select>
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="估计的佣金(%)" prop="part_com">
                  <el-input v-model="predict_part.part_com" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="提醒描述" prop="part_reminddes">
                  <el-input v-model="predict_part.part_reminddes" />
                </el-form-item>
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="12">
                <el-form-item label="提醒日期" prop="part_reminddate">
                  <el-date-picker v-model="predict_part.part_reminddate" type="date" style='width:100%' value-format="yyyy-MM-dd" />
                </el-form-item>
              </el-col>
            </el-row>
          </div>
          <el-button @click="businesStructureAddSubmit('')" type='success' size="mini"><i class='fa fa-check'></i>保存</el-button>
          <el-button @click="gotoPage('FCE7214635C54924BCDDD19A731C55A2?'+vueparams+'')" type='primary' size="mini"><i class='fa fa-reply'></i>取消</el-button>
        </el-form>
      </el-col>
      <el-col :span='2' :xs='24'>
        <el-menu default-active='active' class='menu-unit'>
          <el-menu-item v-for='item in Container'>
            <el-link @click="gotoMenu(item.url)" :type="'商机管理'===item.name?'primary':'default'">{{item.page_desc||item.name}}</el-link>
          </el-menu-item>
        </el-menu>
      </el-col>
    </el-row>
  </div>
</template>
<script>
  import request from '@/utils/request'
  export default {
    name: 'BusinesStructureAdd',
    components: {},
    props: ['popparams'],
    data() {
      return {
        vueparams: this.getVUEParams(""),
        predict_part: {
          part_des: null,
          part_person: null,
          part_extrades: null,
          part_origin: null,
          part_max: null,
          part_min: null,
          part_opt: null,
          part_clised: null,
          part_closedate: null,
          part_limit: null,
          part_com: null,
          part_reminddes: null,
          part_reminddate: null,
        },
        person: [],
        loading: false,
        Container: null,
        rules: {}
      }
    },
    created() {
      this.getData();
      this.loadContainerMenu({
        pid: "80299289AF2443B18EA545A4C0C37170",
        name: "客户管理右菜单",
        selected: "商机管理"
      }, 'Container', this.vueparams);
    },
    updated() {},
    mounted() {},
    methods: {
      getData() {
        request({
          method: 'get',
          url: '/xcapi/VUEAction/psi/supplychainmana/SupplierCtrl/businesStructureAdd?' + this.vueparams,
        }).then(data => {
          for (var k in data) {
            if (Array.isArray(data[k])) {
              this[k] = data[k];
            } else {
              $.extend(this[k], data[k]);
            }
          }
        })
      },
      businesStructureAddSubmit(_params) {
        this.$refs["form"].validate(valid => {
          if (valid) {
            request({
              method: 'post',
              url: '/xcapi/VUEAction/psi/supplychainmana/SupplierCtrl/businesStructureAddSubmit?' + _params + this.vueparams,
              data: this.postData()
            }).then(data => {
              this.$router.replace("/redirect" + this.$route.fullPath);
              this.msgSuccess(data.msg);
            })
          } else {
            this.msgError("必填项错误");
          }
        });
      },
    },
  }
</script>
